package com.sgcc.activiti.config;

import com.sgcc.activiti.service.IOSupplierEvaluationService;
import com.sgcc.common.core.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by jingqian on 2021/4/9.
 */
@Component
public class SupplierTimedTask {

    private Logger logger = LoggerFactory.getLogger(SupplierTimedTask.class);

    @Autowired
    private IOSupplierEvaluationService ioSupplierEvaluationService;

    // 每月月初统计供应商的异常
    @Scheduled(cron = "0 0 1 1 * ?")
//    @Scheduled(cron = "0 0/2 * * * ?")
    public void execute() {

        logger.info("月初统计供应商的异常情况任务开始："+ DateUtils.dateTime(new Date()));
        ioSupplierEvaluationService.execute();
        logger.info("月初统计供应商的异常情况任务结束："+ DateUtils.dateTime(new Date()));
    }

}
